//
//  ViewController.m
//  ObjectCChained
//
//  Created by sny on 2018/5/16.
//  Copyright © 2018年 HuangYangYang. All rights reserved.
//

#import "ViewController.h"
#import "User.h"
#import "Focus.h"

@interface ViewController ()<UIScrollViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSLog(@"password : %@",[self creatStepUp]);
}

- (NSString *)creatNextStepUp {
    int success = 0;
    NSString *password;
    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"htttp://www.baidu.com"]];
    if (data.length > 0) {
        // TO DO Choose
        //...........
        //............
        //...........
        success = 0;
        password = @"123456";
    }else{
        success = 1001;
        password = @"no passWord";
    }
    
    return password;
}


- (NSString *)creatStepUp {
    
    NSString *__block passWord;

    return [self initalControlWithData:[NSData data] WithCheckSuccess:^(NSString *string) {
        passWord = string;
    }] == 0 ?  passWord : @"no passWord";
}

- (int)initalControlWithData:(NSData *)data WithCheckSuccess:(void(^)(NSString *string))success {
    
    if (data.length > 0) {
        // TO DO Choose
        //...........
        //............
        //...........
        success(@"123456");
        return 0;
    }
    
    return 1003;
}

@end
